<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>货物预定系统</title>
<script type="text/javascript" src="__ROOT__/static/script/jq.js"></script><script type="text/javascript" src="__ROOT__/static/script/jquery-ui.js"></script><script type="text/javascript" src="__ROOT__/static/script/jquery-blockUI.js"></script><script type="text/javascript" src="__ROOT__/static/script/admin_script.js"></script><script type="text/javascript" src="__ROOT__/static/script/home.js"></script>
<link rel="stylesheet" type="text/css" href="__ROOT__/static/style/admin_style.css" />
</head>

<body>
<div id="page_head">
  <div class="masthead">
    <h1 class="logo"></h1>
    <div id="nav">
      <ul id="mainnav">
        
        <li <?php if(MODULE_NAME == 'Bookinfo'): ?>class="cur"<?php endif; ?>><a href="<?php echo U('Home/Bookinfo/index');?>">订货信息</a>
        </li>
          <li <?php if(MODULE_NAME == 'Bookgoods'): ?>class="cur"<?php endif; ?>><a href="<?php echo U('Home/Bookgoods/index');?>">订购货物</a>
        </li>
        <li <?php if(MODULE_NAME == 'Userinfo'): ?>class="cur"<?php endif; ?>><a href="<?php echo U('Home/Userinfo/index');?>">个人信息</a>
        </li>
      </ul>
    </div>
    
    <script type="text/javascript">
		/*mainnav*/
		jQuery('#mainnav li').hover(function(){jQuery('ul', this).slideDown(200);},function(){jQuery('ul', this).slideUp(300);});	
  	</script>
      	
    <div class="us_info"> <a href="#" class="l"><?php if(file_exists('./upload/user/thumb/'.$user['id'].'/big')) echo "<img src='/upload/user/thumb/".$user['id']."/big' width='40' height='40' />"; ?></a> user用户 <a href="#" style="color:red;"><?php echo ($unick); ?></a> <i>|</i> <a href="<?php echo U('Home/Login/Logout');?>">退出</a> <br />
<!--      <span>角色：管理员</span>-->
    </div>
  </div>
  
<div id="tool_bar">
    <div class="plugin"></div>
    <div class="search r">
    </div>
</div>
<div id="page_body">
    <div class="main_warp" id="main_warp">
        <div class="main_body" id="main_body">  

            <div class="mod space">
                <div class="m_bd">
                    <div class="form">
                        <form method="POST" action="<?php echo U('Home/Bookgoods/book_goods');?>" style="margin:0">
                            <div class="m_head" align="center">  
                                <div style="padding-top: 20px;padding-bottom: 20px">
                                    <table border="1" id="datatable">
                                        <tr>
                                            <th colspan="8" background="__ROOT__/static/images/tab_05.gif">货物清单</th>
                                        </tr>
                                        <tr>
                                            <th background="__ROOT__/static/images/tab_14.gif">编号</th>
                                            <th background="__ROOT__/static/images/tab_14.gif">名称</th>
                                            <th background="__ROOT__/static/images/tab_14.gif">规格</th>
                                            <th background="__ROOT__/static/images/tab_14.gif">单位</th>
                                            <th background="__ROOT__/static/images/tab_14.gif">单价</th>
                                            <th background="__ROOT__/static/images/tab_14.gif">数量</th>
                                            <th background="__ROOT__/static/images/tab_14.gif">总价</th>
                                            <th background="__ROOT__/static/images/tab_14.gif">备注</th>
                                        </tr>
                                        <?php if(is_array($goodsList)): $i = 0; $__LIST__ = $goodsList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$goodsList): $mod = ($i % 2 );++$i; if($goodsList["goodsname"] != ''): ?><tr>
                                                    <td width="100px" align="center"><input id="goodscode_<<?php echo ($goodsList["id"]); ?>>" type='text' name='goodscode[<?php echo ($goodsList["id"]); ?>]' class="text" value='<?php echo ($goodsList["goodscode"]); ?>' style="border: 0px;text-align: center" readonly/></td>
                                                    <td width="100px" align="center"><input id="goodsname_<<?php echo ($goodsList["id"]); ?>>" type='text' name='goodsname[<?php echo ($goodsList["id"]); ?>]' class="text" value='<?php echo ($goodsList["goodsname"]); ?>' style="border: 0px;text-align: center" readonly/></td>
                                                    <td width="100px" align="center"><input id="goodsstandard_<<?php echo ($goodsList["id"]); ?>>" type='text' name='goodsstandard[<?php echo ($goodsList["id"]); ?>]' class="text" value='<?php echo ($goodsList["goodsstandard"]); ?>' style="border: 0px;text-align: center" readonly/></td>
                                                    <td width="100px" align="center"><input id="goodsunit_<<?php echo ($goodsList["id"]); ?>>" type='text' name='goodsunit[<?php echo ($goodsList["id"]); ?>]' class="text" value='<?php echo ($goodsList["goodsunit"]); ?>' style="border: 0px;text-align: center" readonly/></td>
                                                    <td width="100px" align="center"><input id="goodsprice_<<?php echo ($goodsList["id"]); ?>>" type='text' name='goodsprice[<?php echo ($goodsList["id"]); ?>]' class="text" value='<?php echo ($goodsList["goodsprice"]); ?>' style="border: 0px;text-align: center" readonly/></td>
                                                    <td width="100px" align="center"><input id="goodsnum_<<?php echo ($goodsList["id"]); ?>>" type='text' name='goodsnum[<?php echo ($goodsList["id"]); ?>]' class="in_text" value="0" style="width: 70px;text-align: center"/></td>
                                                    <td width="100px" align="center"><input id="goodsmoney_<<?php echo ($goodsList["id"]); ?>>" type='text' name='goodsmoney[<?php echo ($goodsList["id"]); ?>]' class="text" value='0' data-type='goodsmoney' style="border: 0px;text-align: center" readonly/></td>                          
                                                    <td width="100px" align="center"><input id="goodsremark_<<?php echo ($goodsList["id"]); ?>>" type='text' name='goodsremark[<?php echo ($goodsList["id"]); ?>]' class="text" value='<?php echo ($goodsList["remark"]); ?>' style="border: 0px;text-align: center" readonly/></td>
                                                </tr><?php endif; endforeach; endif; else: echo "" ;endif; ?>>           
                                        <tr>
                                            <th colspan="8"><span>总价：</span><input id="total" type='text' name='total' class="text" value='0' style=" border: 0px;text-align: center" readonly/></th>
                                        </tr>
                                    </table>
                                    <INPUT TYPE="submit" class="button" value="提交" style="margin-top: 40px;padding-left: 20px;padding-right: 20px;padding-bottom: 10px;padding-top: 10px"/>
                                </div>
                            </div>
                            <hr style="color: black" />

                        </form>
                    </div>

                </div>

            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $("td input", $("#datatable")).keyup(function(event) {
            var target = $(event.target);
            var num = target.val();
            var price = target.parent().prev().find("input").val();
            target.parent().next().find("input").val(parseFloat(num * price).toFixed(2));
            var total = 0;
            $("td input[data-type=goodsmoney]", $("#datatable")).each(function() {
                total = total + parseFloat($(this).val());
            });
            document.getElementById("total").value = total;
            //$("#total").html(total);
        });
    });

</script>

<div id="page_foot"> <span class="l">货物预定系统 V1.0</span> <span class="r">Copyright©2014 邮缘科技 版权所有</span> </div>
<script type="text/javascript" src="__ROOT__/static/script/admin_page.js"></script>
</body>
</html>